# -*- coding: utf-8 -*-
# @Time    : 2023/6/5 9:35
# @Author  : 刘张宇
# @Email   : 2285524065@qq.com
# @File    : .py
# @Software: PyCharm

from appium.webdriver.common.mobileby import MobileBy as By
from pages.base_page import BasePage

class ShoppingCart(BasePage):
    shopping_cart_locator = (By.XPATH, '//*[@resource-id="com.xiachufang:id/dt_buy_cart"]')#购物车定位器
    edit_locator = (By.XPATH, '//*[@resource-id="com.xiachufang:id/navigation_item_right_view_layout"]')#编辑定位器
    click_locator = (By.XPATH, '//*[@resource-id="com.xiachufang:id/cart_goods_check_box"]')#勾选定位器
    delete_locator = (By.XPATH, '//*[@resource-id="com.xiachufang:id/cart_settlement_btn"]')#删除物品定位器
    title_locator = (By.XPATH, '')

    def menu_shopping_cart(self):
        self.find_element(self.shopping_cart_locator).click()#购物车

    def menu_edit(self):
        self.find_element(self.edit_locator).click()#编辑

    def menu_click(self):
        self.find_element(self.click_locator).click()#勾选物品

    def menu_delete(self):
        self.find_element(self.delete_locator).click()#删除物品

    def task_first(self):
        current_task = self.find_element(self.title_locator).
        return current_task